home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 15314 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: eccdb1.pms.ford.com!pms991!mbobak
  2. From: mbobak@pms991.uucp (Mark J. Bobak)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: saving system()'s output to a C variable?
  5. Date: 18 Apr 1996 12:52:00 GMT
  6. Organization: Not an Official Spokesperson for Ford Motor Company, Dearborn, MI
  7. Message-ID: <4l5dtg$9d2@eccdb1.pms.ford.com>
  8. References: <96104.233554U61441@uicvm.uic.edu>
  9. NNTP-Posting-Host: pms991.pms.ford.com
  10.  
  11. In article <96104.233554U61441@uicvm.uic.edu>,
  12. Sikander Waheed  <U61441@uicvm.uic.edu> wrote:
  13. >Hi,
  14. >  Is it possible to save the output of the system() command to
  15. >a C variable? For example, when I have the line system("date")
  16. >in my C program, I want the output of this command to go to a
  17. >C variable (e.g. char array) instead of going on the stdout.
  18. >Please send me email at swaheed@uic.edu
  19.  
  20.  
  21. No, not exactly.  You can use popen() to open a stream and read the output
  22. of the command from the stream into a c variable.
  23.  
  24. -Mark
  25. -- 
  26. Mark J. Bobak, Application Developer
  27. Advanced Vehicle & Computer Aided Engineering Systems Department
  28. Process Leadership, Ford Motor Company
  29. mbobak@ford.com
  30.